<?php
//数据库配置
$dbsql=array(
    'host' => 'localhost',
    'port' => 3306,
    'user' => 'root',
    'pwd' => '',
    'dbname' => 'image'
);

//连接数据库
$conn=mysqli_connect($dbsql['host'],$dbsql['user'],$dbsql['pwd']); 
if(!$conn){ 
	echo '<script>window.location.href="start/index.html";</script>';  
	exit();
}    //失败退出
mysqli_select_db($conn,'image');
mysqli_set_charset($conn, 'utf8mb4');
$conn->query("set names utf8");

//检测当前的用户
$username='';
if(isset($_COOKIE['logonstate'])){
	$logonstate = $_COOKIE['logonstate'];
    $sql = mysqli_query($conn,"SELECT username,qqnum,ints,state FROM loginstate WHERE lid = '$logonstate'");
    $Logons = mysqli_fetch_array($sql);
	if($Logons){
		$username = $Logons['username'];
		$state = $Logons['state'];
		$qqnum = $Logons['qqnum'];
	}
}
?>